import Vue from 'vue'
import VueRouter from 'vue-router'
import LoginView from '../views/Login.vue'
import Register from '../views/Register.vue'
import Manager from "@/views/Manager";
import TenantManage from '../views/TenantManage'
import ManagerDetail  from "@/views/ManagerDetail";
import FindPwd from "@/views/FindPwd";
import ConsumerManage from "@/views/ConsumerManage";
import QuestionnaireManage from "@/views/QuestionnaireManage";
import BillingManage from "@/views/BillingManage";
import Consumer from "@/views/Consumer";
import ConsumerDetail  from "@/views/ConsumerDetail";
import GroupManage from "@/views/GroupManage";
import Tenant from "@/views/Tenant";
import TenantDetail  from "@/views/TenantDetail";
import RespondentManage from "@/views/RespondentManage";
import Respondent from "@/views/Respondent";
import DoQuestionnaire from "@/views/DoQuestionnaire";
import HistoryResult from "@/views/HistoryResult";
import DataScreen from "@/views/DataScreen";
import TenantStatistics from "@/views/TenantStatistics";
import CostCheck from "@/views/CostCheck";

Vue.use(VueRouter)

const routes = [

  {
    path: '/',
    name: 'Login',
    component: LoginView
  },
  {
    path: '/Register',
    name: 'Register',
    component: Register
  },
  {
    path: '/Manager/',
    name: 'Manager',
    component: Manager,
    redirect:"/Manager/TenantManage",
    children: [
      {
        path: 'TenantManage', name: 'TenantManage', component: TenantManage,
      },
      {
        path: 'ConsumerManage', name: 'ConsumerManage', component: ConsumerManage,
      },
      {
        path: 'ManagerDetail', name: 'ManagerDetail', component: ManagerDetail,
      },
      {
        path: 'QuestionnaireManage', name: 'QuestionnaireManage', component: QuestionnaireManage,
      },
      {
        path: 'BillingManage', name: 'BillingManage', component: BillingManage,
      },
      {
        path: 'TenantStatistics', name: 'TenantStatistics', component: TenantStatistics,
      },
      {
        path: 'CostCheck',
        name: 'CostCheck',
        component: CostCheck
      }
    ]
  },
  {
    path: '/FindPwd',
    name: 'FindPwd',
    component: FindPwd
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },
  {
    path: '/Consumer/',
    name: 'Consumer',
    component: Consumer,
    redirect:"/Consumer/GroupManage",
    children: [
      {
        path: 'GroupManage', name: 'GroupManage', component: GroupManage,
      },
      {
        path: 'RespondentManage', name: 'RespondentManage', component: RespondentManage,
      },
      {
        path: 'QuestionnaireManage', name: 'QuestionnaireManage', component: QuestionnaireManage,
      },
      {
        path: 'ConsumerDetail', name: 'ConsumerDetail', component: ConsumerDetail,
      },
      {
        path: 'DataScreen', name: 'DataScreen', component: DataScreen,
      }
    ]
  },
  {
    path: '/Tenant/',
    name: 'Tenant',
    component: Tenant,
    redirect:"/Tenant/GroupManage",
    children: [
      {
        path: 'GroupManage', name: 'GroupManage', component: GroupManage,
      },
      {
        path: 'ConsumerManage', name: 'ConsumerManage', component: ConsumerManage,
      },
      {
        path: 'QuestionnaireManage', name: 'QuestionnaireManage', component: QuestionnaireManage,
      },
      {
        path: 'TenantDetail', name: 'TenantDetail', component: TenantDetail,
      }
    ]
  },  {
    path: '/Respondent/',
    name: 'Respondent',
    component: Respondent,
    redirect:"/Respondent/DoQuestionnaire",
    children: [
      {
        path: 'DoQuestionnaire', name: 'DoQuestionnaire', component: DoQuestionnaire,
      },
      {
        path: 'HistoryResult', name: 'HistoryResult', component: HistoryResult,
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
